package value

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object flatMapTest {
  def main(args: Array[String]): Unit = {
    //1.创建SparkConf并设置App名称
    val conf = new SparkConf().setAppName("SparkCoreTest").setMaster("local[*]")

    //2.创建SparkContext，该对象是提交Spark App的入口
    val sc = new SparkContext(conf)

    val value: RDD[List[Int]] = sc.makeRDD(List(List(1,2),List(3,4),List(5,6)),2)

    val valueFlatMap: RDD[Int] = value.flatMap(list => list)

    valueFlatMap.collect().foreach(println)

    //关闭
    sc.stop();
  }

}
